<template>
  <div class="dashborad">
    <div class="top">
      <el-card class="box-card">
        <div class="main">
          <div class="m-left">
            <img src="@/assets/common/img.jpeg" alt="">
          </div>
          <div class="m-right">
            <div class="ml-top">
              <h4>下午好,我是帅气逼人的彭翀!</h4>
            </div>
            <div class="ml-bottom">
              <span>包哥我能去你家过年吗?</span>
            </div>
          </div>
        </div>

      </el-card>
    </div>
    <div class="bottom">
      <!-- 下面的部分，分为左右两个部分，使用el-row el-col进行布局 -->
      <el-row>
        <el-col :span="14">
          <div style="padding-right: 30px">
            <el-card class="box-card">
              <el-calendar>
                <!-- 这里使用的是 2.5 slot 语法，对于新项目请使用 2.6 slot 语法-->
                <template
                  slot="dateCell"
                  slot-scope="{date, data}"
                >
                  <!-- <p :class="data.isSelected ? 'is-selected' : ''">
                    {{ data.day.split('-').slice(1).join('-') }} {{ data.isSelected ? '✔️' : '' }}
                  </p> -->
                  <div class="my-date">
                    <span>{{ getCurrentDate(data.day) }}</span>
                    <span v-if="isWeekend(date)" class="item">休</span>
                  </div>
                </template>
              </el-calendar>
            </el-card>
            <el-card class="box-card">

              <div>
                <el-popover
                  placement="top-start"
                  title="标题"
                  width="200"
                  trigger="hover"
                  content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。"
                >
                  <el-button slot="reference">hover 激活</el-button>
                </el-popover>
                <el-popover
                  placement="top-start"
                  title="标题"
                  width="200"
                  trigger="hover"
                  content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。"
                >
                  <el-button slot="reference">hover 激活</el-button>
                </el-popover>
                <el-popover
                  placement="top-start"
                  title="标题"
                  width="200"
                  trigger="hover"
                  content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。"
                >
                  <el-button slot="reference">hover 激活</el-button>
                </el-popover>
                <el-popover
                  placement="top-start"
                  title="标题"
                  width="200"
                  trigger="hover"
                  content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。"
                >
                  <el-button slot="reference">hover 激活</el-button>
                </el-popover>
              </div>
            </el-card>
          </div>
        </el-col>
        <el-col :span="10">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>卡片名称</span>
              <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
            </div>
            <div>
              <div class="block">
                <el-carousel height="150px">
                  <el-carousel-item v-for="item in 4" :key="item">
                    <!-- <h3 class="small">{{ item }}</h3> -->
                  </el-carousel-item>
                </el-carousel>
              </div>
            </div>
          </el-card>
          <el-card class="box-card">
            <!--放雷达图的地方  -->
            <Radix />
          </el-card>
          <el-card class="box-card">
            <div class="last">
              <div class="l-header">
                <span>帮助链接</span>
              </div>
              <div class="l-main">
                内容
              </div>
            </div>

          </el-card>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import Radix from './radix.vue'
export default {
  name: '',
  components: {
    Radix
  },
  data() {
    return {
      navImg: [

      ]
    }
  },
  methods: {
    fn(date, data) {
      // console.log(date, data)
    },
    getCurrentDate(date) {
      // console.log(date)
      const currentDateStr = date.slice(8)
      return currentDateStr.startsWith('0') ? currentDateStr.slice(1) : currentDateStr
    },
    isWeekend(date) {
      const currentDay = date.getDay()
      if (currentDay === 0 || currentDay === 6) {
        return true
      }
      return false
    }
  }
}
</script>

<style lang="scss" scoped>
.dashborad {
  .is-selected {
    color: #1989FA;
  }
  margin: 15px;
  .top {
    margin-bottom: 15px;
  }
  .el-card {
    margin-bottom: 15px;
  }
  .main {
    display: flex;
    .m-left {
      img {
        display: block;
        width: 100px;
        border-radius: 50%;
      }

    }
    .m-right {
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      .mr-top {
        font: size 22px;
        font-weight: 700;
      }
      .mr-bottom {
        color: #beb8b8;
        position: relative;
        top: -15px;
        left: 5px;
      }
    }
  }
  .my-date{
        display: flex;
        justify-content: space-around;
        // align-items: center;
       padding: 0 4px;
    .item {
      display: block;
      width: 20px;
      height: 20px;
      background-color: #f5aa42;
      text-align: center;
      line-height: 20px;
      color: white;
      border-radius: 50%;
    }
  }
  // 帮助链接样式
  .last {
  .l-header {
    font-size: 25px;
      font-weight: 600;
    span {
      border-bottom: 5px solid #767aea;
      padding-bottom: 10px;
      }
    }
  .l-main {
    margin-top: 25px;
  }
  }
 .el-carousel__item h3 {
    color: #475669;
    font-size: 14px;
    opacity: 0.75;
    line-height: 150px;
    margin: 0;
  }

  .el-carousel__item:nth-child(2n) {
     background-color: #99a9bf;
  }

  .el-carousel__item:nth-child(2n+1) {
     background-color: #d3dce6;
  }
}
</style>
